<!-- holo3D属性 -->
<template>
    <div class="map3d map">
        <div class="main-text-tran-50">
            <span>模型文件地址</span>
        </div>
        <textarea :id="holo3dMap.getModelFileAddressName()" :rows="5" />
        <div class="main-text-tran-50">
            <span>栅格瓦片地址</span>
        </div>
        <textarea :id="holo3dMap.getGridFileAddressName()" :rows="5" />
        <div class="main-text-tran-50">
            <span>地形文件地址</span>
        </div>
        <textarea :id="holo3dMap.getTerrainFileAddressName()" :rows="5" />
        <div class="edit-btn">
            <div class="clear" @click="clearWebGLMap">清 除</div>
            <div class="affirm" @click="setGlobalParam">确 定</div>
        </div>
    </div>
</template>

<script>
import holo3dMap from '@/js/main/attribute/holo3dMap.js';
import store from '@/js/store/state.js';
import JQuery from 'jquery';
import history from '@/js/main/history.js';
import system from '@/js/main/system.js';
import register from '@/js/main/register.js';

export default {
    data() {
        return {
            window: window,
            holo3dMap: holo3dMap,
            JQuery: JQuery,
            store: store,
            history: history,
            currentElementList: store.getCurrentElementList()
        };
    },
    components: {},
    computed: {},
    mounted() {
        holo3dMap.setAttribute(this.currentElementList[0]);
    },
    methods: {
        setGlobalParam() {
            holo3dMap.setModelFileUrl(this.currentElementList[0], JQuery('#' + holo3dMap.getModelFileAddressName()).val(), false);
            holo3dMap.setGridFileUrl(this.currentElementList[0], JQuery('#' + holo3dMap.getGridFileAddressName()).val(), false);
            holo3dMap.setTerrainFileUrl(this.currentElementList[0], JQuery('#' + holo3dMap.getTerrainFileAddressName()).val(), false);
            register.getComponentById(`${system.SYSTEM_EDIT_ELEMENT + this.currentElementList[0].id}`).setGlobalParam();
            history.addHistory(store.clone(), 31);
        },
        clearWebGLMap() {
            holo3dMap.setModelFileUrl(this.currentElementList[0], '', true);
            holo3dMap.setGridFileUrl(this.currentElementList[0], '', true);
            holo3dMap.setTerrainFileUrl(this.currentElementList[0], '', true);
            this.setGlobalParam();
            history.addHistory(store.clone(), 30);
        }
    }
};
</script>
<style lang='scss' scoped>
.map3d {
    padding-left: 10px;
    textarea {
        padding: 5px;
    }
    .main-text-tran-50 {
        font-weight: 600;
        line-height: 30px;
    }
}
</style>